<template>
  <section id="Userinfo">
    <section class="middle">
      <section class="user-image"><img :src="src" /></section>
      <section class="user-info">
        <el-form ref="form" :model="form" :rules="rules">
          <el-form-item label="用户名">
            <el-input type="text" v-model="form.name" :readonly="isReadonly"></el-input>
          </el-form-item>
          <el-form-item label="昵称">
            <el-input type="text" v-model="form.nickname" :readonly="isReadonly"></el-input>
          </el-form-item>
          <el-form-item label="工号">
            <el-input type="text" v-model="form.jobNum" :readonly="isReadonly"></el-input>
          </el-form-item>
          <el-form-item label="手机号">
            <el-input type="text" v-model="form.phone" :readonly="isReadonly"></el-input>
          </el-form-item>
          <el-form-item label="邮箱">
            <el-input type="text" v-model="form.email" :readonly="isReadonly"></el-input>
          </el-form-item>
        </el-form>
      </section>
    </section>
  </section>
</template>

<script>
export default {
  data: () => ({
    src: '',
    form: {},
    rules: {},
    isReadonly: true
  }),
  created() {
    this.form = this.$store.state.userinfo
    this.src = require('../../assets/images/global/bingce.png')
  },
  mounted() {
    this.form = this.$store.state.userinfo
    this.src = require('../../assets/images/global/bingce.png')
  },
  updated() {
    this.form = this.$store.state.userinfo
    this.src = require('../../assets/images/global/bingce.png')
  }
}
</script>

<style lang="scss" scoped>
#Userinfo {
  width: 100%;
  height: 100%;
  box-sizing: border-box;

  .middle {
    margin: 0 auto;
    padding: 2rem 0;
    width: 30rem;

    .user-image {
      margin: 0 auto 2rem;
      width: 12rem;
      height: 12rem;
      overflow: hidden;
      border-radius: 50%;
      display: flex;
      justify-content: center;
      align-items: center;
      box-shadow: 0.2rem 0.2rem 0.3rem rgba(0, 0, 0, 0.3), -0.05rem -0.05rem 0.05rem rgba(0, 0, 0, 0.1);

      img {
        display: block;
        width: 65%;
        height: 65%;
      }
    }

    .user-info {
    }
  }
}
</style>
